package com.wind.trademark.chart.controller;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wind.trademark.chart.vo.BarParam;
import com.wind.trademark.chart.vo.PieParam;
import com.wind.trademark.chart.vo.Point;

@Controller
public class ChartController {
 
	private static final Log log = LogFactory.getLog(ChartController.class);

	

	@RequestMapping
	public @ResponseBody
	float[][] getLineChartData() {
		List<Point> pointList=new ArrayList<Point>();
		pointList.add(new Point(0, 0));
		pointList.add(new Point(1, 1));
		pointList.add(new Point(2, 2));
		pointList.add(new Point(3, 3));
		pointList.add(new Point(4, 4));
		pointList.add(new Point(5, 5));
		float[][]  result =  Point.translatePofloatList2twoDimensionalArray(pointList);
		return result;
	}

	@RequestMapping
	public @ResponseBody
	Object[][] getBarChartData() {
		List<BarParam> barParamList=new ArrayList<BarParam>();
		barParamList.add(new BarParam("A", 0));
		barParamList.add(new BarParam("B", 1));
		barParamList.add(new BarParam("C", 2));
		barParamList.add(new BarParam("D", 3));
		barParamList.add(new BarParam("E", 4));
		Object[][]  result =  BarParam.translateBarParamList2twoDimensionalArray(barParamList);
		return result;
	}
	
	@RequestMapping
	public @ResponseBody
	Object[][] getPieChartData() {
		List<PieParam> pieParamList=new ArrayList<PieParam>();
		pieParamList.add(new PieParam("A", 10));
		pieParamList.add(new PieParam("B", 20));
		pieParamList.add(new PieParam("C", 10));
		pieParamList.add(new PieParam("D", 30));
		pieParamList.add(new PieParam("E", 40));
		Object[][]  result =  PieParam.translatePieParamList2twoDimensionalArray(pieParamList);
		return result;
		
	}
	
}
